<?php
/**
 * 로그파일 드렉토리 탐색
 */
class libFileSearch
{



    static public function getDirList($sDir)
    {

        if ($sDir[strlen($sDir)-1] != '/') $sDir .= '/';

        if (!is_dir($sDir)) return array();


        $oDirHandle  = opendir($sDir);
        $aDirs = array();

        while ($sReadDir = readdir($oDirHandle)) {
            if (!in_array($sReadDir, array('.','..'))) {
                $sFileName    = $sDir . $sReadDir;
                $aFile = array(
                        'name' => $sReadDir,
                        'size' => filesize($sFileName),
                        'type' => filetype($sFileName),
                        'time' => date("Y-m-d H:i:s", filemtime($sFileName))
                );
                $aDirs[] = $aFile;
            }
        }

        return $aDirs;

    }


    static public function getRead($sDir)
    {
        return file_get_contents($sDir);
    }


}